/**
 * 
 */
package org.corpus.english.view;

import org.corpus.english.model.Sentence;
import org.corpus.english.model.SentenceSourceData;
import org.zkoss.zk.ui.Component;
import org.zkoss.zkplus.databind.TypeConverter;
import org.zkoss.zul.Treeitem;


/**
 * @author robbiecheng
 *
 */
public class SentenceSourceConverter implements TypeConverter{

	public Object coerceToBean(Object val, Component comp) {
		((Sentence)val).setSentenceSourceData((SentenceSourceData) ((SentenceSourceTreeNode)((Treeitem)comp).getValue()).getValue());
		return null;
	}

	public Object coerceToUi(Object val, Component comp) {
		((Treeitem)comp).setSelected(true);
		return null;
	}

}
